package studyNote.test;

import java.util.Arrays;
import java.util.Random;

public class BubbleSortPractice {

    public static void main(String[] args) {

        Random random = new Random();
        int[] ints = new int[10];
        for (int i = 0; i < 10; i++) {
            ints[i] = random.nextInt(100);
        }
        System.out.println("排序前：");
        for (int anInt : ints) {
            System.out.print(anInt + " ");
        }
        System.out.println();

        // for (int i = 0; i < ints.length - 1; i++) {
        //     for (int j = 0; j < ints.length - 1 - i; j++) {
        //         if (ints[j] > ints[j + 1]) {
        //             int temp = ints[j];
        //             ints[j] = ints[j + 1];
        //             ints[j + 1] = temp;
        //         }
        //     }
        // }

        Arrays.sort(ints);

        System.out.println("排序后：");
        for (int anInt : ints) {
            System.out.print(anInt + " ");
        }

    }

}
